//https://www.nowcoder.com/practice/22948c2cad484e0291350abad86136c3?tpId=37&tqId=21331&ru=/exam/oj

#include <iostream>
using namespace std;
int gcd(int a, int b)
{
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main()
{
	int a, b;
	cin >> a >> b;
	cout << (a * b / gcd(a, b)) << endl;
	return 0;
}

//https://www.nowcoder.com/practice/eac1c953170243338f941959146ac4bf?tpId=196&tqId=37143&ru=/exam/oj

class Solution
{
public:
	int MLS(vector<int>& arr)
	{
		sort(arr.begin(), arr.end());
		int n = arr.size(), ret = 0;
		for (int i = 0; i < n; )
		{
			int j = i + 1, count = 1;
			while (j < n)
			{
				if (arr[j] - arr[j - 1] == 1)
				{
					count++;
					j++;
				}
				else if (arr[j] - arr[j - 1] == 0)
				{
					j++;
				}
				else
				{
					break;
				}
			}
			ret = max(ret, count);
			i = j;
		}
		return ret;
	}
};




//https://www.nowcoder.com/practice/9740ce2df0a04399a5ade1927d34c1e1?tpId=230&tqId=38954&ru=/exam/oj

#include <iostream>
using namespace std;
const int N = 510;
char g[N][N];
int dp[N][N];
int m, n;
int main()
{
	cin >> m >> n;
	for (int i = 1; i <= m; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			cin >> g[i][j];
		}
	}
	for (int i = 1; i <= m; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			int t = 0;
			if (g[i][j] == 'l') t = 4;
			else if (g[i][j] == 'o') t = 3;
			else if (g[i][j] == 'v') t = 2;
			else if (g[i][j] == 'e') t = 1;
			dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) + t;
		}
	}
	cout << dp[m][n] << endl;
	return 0;
}